package com.example.demo1102.demo2;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ExecutorMethod {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(5);
        for (int i = 0; i < 10; i++) {
            final  int a=i;
            executorService.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName()+"====="+a);
                }
            });
        }
        executorService.shutdown();
        boolean shutdown = executorService.isShutdown();
        System.out.println(shutdown);
        boolean terminated = executorService.isTerminated();
        System.out.println(terminated);

    }
}
